﻿IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[spInitializeInstallBatchScripts]') AND type in (N'P', N'PC'))
	DROP PROCEDURE [dbo].[spInitializeInstallBatchScripts]
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[spDBA_get_managed_server_list]') AND type in (N'P', N'PC'))
	DROP PROCEDURE [dbo].[spDBA_get_managed_server_list]
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[spDBA_discover_server]') AND type in (N'P', N'PC'))
	DROP PROCEDURE [dbo].[spDBA_discover_server]
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[spDBA_purge_unnecessary_performance_counters]') AND type in (N'P', N'PC'))
	DROP PROCEDURE [dbo].[spDBA_purge_unnecessary_performance_counters]
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[spDBA_update_server]') AND type in (N'P', N'PC'))
	DROP PROCEDURE [dbo].[spDBA_update_server]
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[spDBA_update_server_inerror]') AND type in (N'P', N'PC'))
	DROP PROCEDURE [dbo].[spDBA_update_server_inerror]
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[spCtrlmExecuteScheduledJob]') AND type in (N'P', N'PC'))
	DROP PROCEDURE [dbo].[spCtrlmExecuteScheduledJob]
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[spCtrlmSetupPermissions]') AND type in (N'P', N'PC'))
	DROP PROCEDURE [dbo].[spCtrlmSetupPermissions]
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[spMaintenanceGetServerInformation]') AND type in (N'P', N'PC'))
	DROP PROCEDURE [dbo].[spMaintenanceGetServerInformation]


IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[fncCompuwareAgentList]') AND type in (N'FN', N'IF', N'TF', N'FS', N'FT'))
	DROP FUNCTION [dbo].[fncCompuwareAgentList]
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[fncSqlInstanceList]') AND type in (N'FN', N'IF', N'TF', N'FS', N'FT'))
	DROP FUNCTION [dbo].[fncSqlInstanceList]


IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tblServer]') AND type in (N'U'))
	DROP TABLE [dbo].[tblServer]
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tblControlmExecution]') AND type in (N'U'))
	DROP TABLE [dbo].[tblControlmExecution]
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tblLoginAudit]') AND type in (N'U'))
	DROP TABLE [dbo].[tblLoginAudit]
